//为了混题写的AC代码

#include <iostream>
#include <cstdio>

using namespace std;

int red = 15;
long long a = 0/*甲*/, b = 0/*乙*/; 

void f(int scr/*球多少分*/, int i/*第i次击球*/, int who/*甲0乙1*/){
    if(scr == 0){
        if(who == 0)    b += 4;
        else            a += 4;
    }
    else if(scr == 1){
        if(who == 0)    a += 1;
        else            b += 1;
    }
    else{
        if(who == 0)    a += scr;
        else            b += scr;
    }
}

int main(){
    int n, m, tmp;
    cin >> n >> m;
    //甲
    for(int i = 1; i <= n; i++){
        scanf("%d", &tmp);
        f(tmp, i, 0);
    }
    //乙
    for(int i = 1; i <= m; i++){
        scanf("%d", &tmp);
        f(tmp, i, 1);
    }
    printf("%lld %lld", a, b);
    return 0;
}
